<div th:fragment="control_chart_condition">
<script type="text/javascript">
	$(function()
	{
		var gatewayRoot = StoreCache.getCache("gatewayRoot");
		var url = gatewayRoot + "microservice-pz/condition/queryConditionXx";
		$.QuickRemote.AjaxJson(url, function(result)
		{
			for ( var i in result)
			{
				var id = result[i]._id.$oid;
				var formMetadata = result[i].formMetadata;
				formMetadata = JSON.parse(formMetadata);
				var li = $("#form-widget-condition").html();
				li = $(li);
				li.find(".predefined-widget-item").attr("_id", id).attr("_mc", formMetadata.MBMC);
				li.find(".title").html(formMetadata.MBMC);
				$("#form-condition").find("ul").append(li);
				initView();
			}
		}, {});
	});
</script>
<script type="text/javascript">
	/**
	 * 
	 */

	/** 选择条件元数据 */
	function metadata_condition(params)
	{
		this.metadata = {
			CONDITION : {
				CONDITION_ID : "",
				CONDITION_MC : ""
			},
			type:"condition"
		};
		return $.extend(new metadata_base(params), this);
	}

	/** 选择条件 元数据视图 面板视图 */
	function metadata_view_condition(control)
	{
		this.settingPanel = $("#form-control-setting");
		this.CONDITION = function()
		{
			var metadataName = "CONDITION";
			var view = $($("#" + metadataName).html());
			var metadata = this.control.getMetadata();
			var mValue = metadata[metadataName];
			$(view).find("[name=CONDITION_MC]").val(mValue["CONDITION_MC"]);
			$(view).find("[name=CONDITION_ID]").val(mValue["CONDITION_ID"]);
			$(this.settingPanel).append(view);
		};
		return $.extend(new metadata_view_base(control), this);
	}

	/** 选择条件 表单视图 */
	function metadata_form_view_condition(jq, metadataControl)
	{
		this.jq = jq;
		var id = $(jq).parent().attr("_id");
		var mc = $(jq).parent().attr("_mc");
		metadataControl.setMetadata("CONDITION", {
			CONDITION_ID : id,
			CONDITION_MC : mc
		});
		this.CONDITION = function(value)
		{
		};
		return $.extend(new metadata_form_view_base(jq), this);
	}
</script>

<!-- 控制面板 选择条件 ID/名称 -->
<script type="text/html" id="CONDITION">
<div class="form-setting-group">
	<label>选择条件模版名称：</label><br>
	<input name="CONDITION_MC" class="setting-panel-input" readonly/><br>
	<label>选择条件ID：</label><br>
	<input name="CONDITION_ID" class="setting-panel-input" readonly/><br>
</div>
</script>
</div>